//
//  HJJourneyHeaderView.m
//  project
//
//  Created by jc on 2019/4/30.
//  Copyright © 2019 健健. All rights reserved.
//

#import "HJJourneyHeaderView.h"
#import "YFJourneyModel.h"

@interface HJJourneyHeaderView ()

@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet UIImageView *journeyImage;
@property (weak, nonatomic) IBOutlet UILabel *journeyTitle;
@property (weak, nonatomic) IBOutlet UILabel *createTime;
@property (weak, nonatomic) IBOutlet UILabel *journeyTime;
@property (weak, nonatomic) IBOutlet UILabel *starLabel;
@property (weak, nonatomic) IBOutlet UILabel *endLabel;

@end
@implementation HJJourneyHeaderView

-(void)awakeFromNib {
    [super awakeFromNib];
    [self.bgView rounded:UIRectCornerAllCorners radius:6];
    
}
-(instancetype)init {
    if (self == [super init]) {
        self = [[NSBundle mainBundle] loadNibNamed:@"HJJourneyHeaderView" owner:nil options:nil].firstObject;
    }
    return self;
}

-(void)setJourneyModel:(YFRecordModel *)journeyModel {
    _journeyModel = journeyModel;
    // 行程标题
    self.journeyTitle.text = journeyModel.tripModel.title;
    
    // 创建时间
    self.createTime.text =  journeyModel.tripModel.createTime;
    
    // 起点名称
    self.starLabel.text = journeyModel.tripModel.startTxt;
    
    // 出行方式
    self.journeyImage.image = journeyModel.tripModel.wayImage;
    
    // 终点名称
    self.endLabel.text = journeyModel.tripModel.dstTxt;
    
    // 出行日期和时间
    self.journeyTime.text = [NSString stringWithFormat:@"%@ %@",journeyModel.tripModel.journeyDate,journeyModel.tripModel.journeyTime];
}

-(void)setModel:(YFTripModel *)model {
    _model = model;
    // 行程标题
    self.journeyTitle.text = model.title;
    
    // 创建时间
    self.createTime.text =  model.createTime;
    
    // 起点名称
    self.starLabel.text = model.startTxt;
    
    // 出行方式
    self.journeyImage.image = model.wayImage;
    
    // 终点名称
    self.endLabel.text = model.dstTxt;
    
    // 出行日期和时间
    self.journeyTime.text = [NSString stringWithFormat:@"%@ %@",model.journeyDate,model.journeyTime];
}
@end
